package org.example;

import java.util.ArrayList;
import java.util.List;

public class Test3 {
    //leetcode 94 二叉树的中序遍历 https://leetcode.cn/problems/binary-tree-inorder-traversal/
    List<Integer> ret;
    public List<Integer> inorderTraversal(TreeNode root) {
        ret = new ArrayList<>();
        inorder(root);
        return ret;
    }

    public void inorder(TreeNode root) {
        if (root == null) return;
        inorder(root.left);
        ret.add(root.val);
        inorder(root.right);
    }
}
